include $(TOPDIR)/core/config/env.mk

USE_LIBC = yes
USE_NANO = yes

#	#if defined(__LOG_UART__)
#		LOG_PRINTF output to debug uart
#	#elif defined(__LOG_ACAT__)
#		LOG_PRINTF output to catstudio
CFLAGS += -D__LOG_UART__
CFLAGS += -DCONFIG_PLAT_LINUX=0
CFLAGS += -DCONFIG_PLAT_ARCH_64BIT=0
CFLAGS += -DCONFIG_DEBUG_LOG=1
CFLAGS += -DCONFIG_DEBUG_LOG_LEVEL_DEBUG=1
CFLAGS += -DCONFIG_ACCESS_ENABLED=1
CFLAGS += -DCONFIG_IOT=1
CFLAGS += -DCONFIG_IOT_MQTTS=1
CFLAGS += -DCONFIG_IOT_MQTTS_TLS=1
CFLAGS += -DCONFIG_PACKET_PAYLOAD_LEN_MAX=128
CFLAGS += -DCONFIG_SEND_BUF_LEN_MAX=256
CFLAGS += -DCONFIG_RECV_BUF_LEN_MAX=256
CFLAGS += -DCONFIG_ACCESS_TOKEN=1
CFLAGS += -DCONFIG_ACCESS_TOKEN_METHOD_SHA1=1
CFLAGS += -DCONFIG_MQTT=1
# CFLAGS += -DNETWORK_TLS=1
CFLAGS += -DCONFIG_NETWORK_TLS_WOLFSSL=1
CFLAGS += -DCONFIG_WOLFSSL_CRYPTO=1
CFLAGS += -DCONFIG_WOLFSSL_TLS=1
CFLAGS += -DCONFIG_BUILD_EXAMPLE=1
CFLAGS += -DCONFIG_HAVE_STDINT=1
CFLAGS += -DCONFIG_CJSON=1
CFLAGS += -DRECV_ECHO
EXTRA_INC +=
EXTRA_LIBS +=

SDK_INC += ./
SDK_INC += sdk
SDK_INC += sdk\common
SDK_INC += sdk\onenet\iot
SDK_INC += sdk\onenet\iot\mqtts
SDK_INC += sdk\onenet\utils
SDK_INC += sdk\onenet\protocols\mqtt
SDK_INC += sdk\onenet\security\tls
SDK_INC += sdk\tools\cJSON
SDK_INC += sdk\tools\wolfssl\port
SDK_INC += sdk\tools\wolfssl\wolfssl-3.15.3
SDK_INC += sdk\onenet\platforms\include




SRCS := sdk/examples/onenet_mqtts/onenet.c

SRCS += sdk/common/data_check.c \
				sdk/common/dlist.c \
				sdk/common/log.c \
				sdk/common/ringbuf.c \
				sdk/common/slist.c \
				sdk/common/utils.c \
				sdk/onenet/utils/dev_token.c \
				sdk/onenet/iot/iot_api.c \
				sdk/onenet/iot/mqtts/iot_mqtts.c \
				sdk/onenet/protocols/mqtt/paho-mqtt/mqtt_client.c \
				sdk/onenet/protocols/mqtt/paho-mqtt/MQTTConnectClient.c \
				sdk/onenet/protocols/mqtt/paho-mqtt/MQTTDeserializePublish.c \
				sdk/onenet/protocols/mqtt/paho-mqtt/MQTTFormat.c \
				sdk/onenet/protocols/mqtt/paho-mqtt/MQTTPacket.c \
				sdk/onenet/protocols/mqtt/paho-mqtt/MQTTSerializePublish.c \
				sdk/onenet/protocols/mqtt/paho-mqtt/MQTTSubscribeClient.c \
				sdk/onenet/protocols/mqtt/paho-mqtt/MQTTUnsubscribeClient.c \
				sdk/onenet/protocols/mqtt/paho-mqtt/mqtt_client.c \
				sdk/onenet/security/tls/aio_tls.c \
				sdk/tools/cJSON/cJSON.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/src/internal.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/src/keys.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/src/ssl.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/src/tls.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/src/wolfio.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/wolfcrypt/src/aes.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/wolfcrypt/src/asn.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/wolfcrypt/src/coding.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/wolfcrypt/src/hash.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/wolfcrypt/src/hmac.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/wolfcrypt/src/integer.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/wolfcrypt/src/md5.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/wolfcrypt/src/misc.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/wolfcrypt/src/random.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/wolfcrypt/src/rsa.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/wolfcrypt/src/sha.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/wolfcrypt/src/sha256.c \
				sdk/tools/wolfssl/wolfssl-3.15.3/wolfcrypt/src/wc_port.c \
				sdk/onenet/platforms/linux/osl_linux.c \
				sdk/onenet/platforms/linux/tcp_linux.c \
				sdk/onenet/platforms/linux/time_linux.c \
				#sdk/onenet/platforms/linux/udp_linux.c
				
SRCS += main.c

include $(TOPDIR)/core/config/rules.mk
FLAGS += -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast